import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-07
 * Time: 19:15
 */
public class Test {
    //求一个整形的二进制的1的个数
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int count = 0;
        while( n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }
    //求两个数的最大公约数
    public static void main7(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = a % b;
        while( c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    //计算分数值
    public static void main6(String[] args) {
        double sum = 0;
        int flag = 1;
        for (int i = 1; i < 100; i++) {
            sum += 1.0/i * flag;
        }
        System.out.println(sum);
    }
    //水仙花数
    public static void main5(String[] args) {
        int i = 0;
        for (i = 0; i < 99999; i++) {
            int tmp = i;
            int count = 0;
            while( tmp != 0){
                tmp /= 10;
                count++;
            }
            tmp = i;
            int sum = 0;
            while( tmp != 0){
                sum += Math.pow( tmp % 10, count);
                tmp /= 10;
            }
            if( sum == i){
                System.out.println(i);
            }
        }
    }
    //打印x图案，要求多行输入
    public static void main4(String[] args) {
        Scanner input = new Scanner(System.in);
        while( input.hasNextInt()){
            int n = input.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if( i == j) {
                        System.out.print("*");
                    }else if( i + j == ( n - 1)){
                        System.out.print("*");
                    }else{
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    //判断素数
    public static void main3(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int i = 0;
        for ( i = 2; i <= Math.sqrt(n) ; i++) {
            if( n % i == 0){
                System.out.println("不是素数");
                break;
            }
        }
        if( i > Math.sqrt(n)) {
            System.out.println(n + "是素数");
        }
    }
    //找出1--100中带9的数字
    public static void main2(String[] args) {
        for (int i = 1; i <=100; i++) {
            if(i % 10 ==  9)
            {
                System.out.println(i);
            }
            if( i / 10 == 9){
                System.out.println(i);
            }
        }
    }
    //输入输出操作
    public static void main1(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("输入一个整形数字");
        int n = input.nextInt();
        System.out.println(n);
        input.nextLine();//消除回车带来的影响***
        System.out.println("输入一个字符串");
        String str = input.nextLine();
        System.out.println(str);
        System.out.println("输入一个浮点型数字");
        float a = input.nextFloat();
        System.out.println(a);
    }
}
